Skip to content

Conversation

@aignas
Copy link
Collaborator

@aignas aignas commented Nov 22, 2025

Before this we were relying on an upstream script, but because how we
are building our docs we need to customize how it is working. What is
more, the format was hard to maintain and prone to human errors.

This splits out the deleted packages code into a separate rc file that
is much easier to work with.

Split out of #3421

Summary:
- Before this we were relying on an upstream script, but because
  how we are building our docs we need to customize how it is working.
- What is more, the format was hard to maintain and prone to human errors.

Split out of bazel-contrib#3421
@aignas aignas requested a review from rickeylev as a code owner November 22, 2025 08:55
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aignas, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors how Bazel's --deleted_packages flags are managed. It extracts the large, manually updated list of deleted packages from the main .bazelrc file into a separate, script-generated configuration file. This change aims to enhance the maintainability of the build configuration, reduce the likelihood of human errors, and better accommodate the project's documentation build process.

Highlights

  • Refactored Deleted Packages Configuration: The extensive list of --deleted_packages in .bazelrc has been moved to a new, dedicated file, .bazelrc.deleted_packages.
  • Improved Maintainability: The new .bazelrc.deleted_packages file is generated by an updated script, making the configuration easier to manage and less prone to manual errors.
  • Streamlined Pre-commit Hook: The pre-commit hook for updating deleted packages now directly executes the shell script, simplifying the process.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the update-deleted-packages script and its integration. Moving the list of deleted packages to a separate .bazelrc.deleted_packages file is a great improvement for readability and maintainability. The new shell script is also much cleaner.

My review includes a few suggestions to improve consistency between the pre-commit hook configuration and the script itself, and to add a clarifying comment for future maintenance. Overall, these are solid improvements.

find examples/*/* tests/*/* \( -name WORKSPACE -or -name MODULE.bazel \) |
{
echo "# Generated via './tools/update_deleted_packages.sh'"
find examples tests gazelle \( -name WORKSPACE -or -name MODULE.bazel \) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This find command is a great improvement. To make it even more robust and consistent with the pre-commit trigger, consider a couple of adjustments:

  1. The .pre-commit-config.yaml for this hook triggers on WORKSPACE.bzlmod files, but this find command doesn't look for them. It would be good to add it for consistency.
  2. The pre-commit files regex is also missing the gazelle directory and BUILD files (it only has BUILD.bazel). While that's in another file, it would be good to update it as part of this PR to ensure the hook triggers correctly. The regex in .pre-commit-config.yaml should probably be ^((examples|tests|gazelle)/.*/(MODULE.bazel|WORKSPACE|WORKSPACE.bzlmod|BUILD.bazel|BUILD)|.bazelrc)$.

Making these consistent will prevent future confusion.

Suggested change
find examples tests gazelle \( -name WORKSPACE -or -name MODULE.bazel \) |
find examples tests gazelle \( -name WORKSPACE -or -name MODULE.bazel -or -name WORKSPACE.bzlmod \) |

xargs -n 1 -I{} find {} \( -name BUILD -or -name BUILD.bazel \) |
xargs -I{} find {} \( -name BUILD -or -name BUILD.bazel \) |
xargs -n 1 dirname |
grep -v "gazelle/docs" |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This grep command filters out the gazelle/docs path. For future maintainability, it would be beneficial to add a comment explaining why this specific path is excluded from the deleted_packages list.

@aignas aignas changed the title chore(pre-commit): fix the update-deleted-packages script chore(bazelrc): fix the update-deleted-packages script Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant